import Base from './Base'
import Questionnaire from './Questionnaire'
import User from './User'
import UserQuestion from './UserQuestion'

class UserScore extends Base {
  constructor ({
    id = '',
    questionnaire = new Questionnaire({}),
    user = new User({}),
    score = 0,
    investmentStyle = '',
    userQuestions = []
  }) {
    super({id})

    this.questionnaire = new Questionnaire(questionnaire)
    this.user = new User(user)
    this.score = score
    this.investmentStyle = investmentStyle
    this.userQuestions = userQuestions.map(v => new UserQuestion(v))
  }

  setQuestionnaire (data = {}) {
    this.questionnaire = new Questionnaire(data)
  }
  setUser (data = {}) {
    this.user = new User(data)
  }
  setUserQuestions (array = []) {
    this.userQuestions = array.map(v => new UserQuestion(v))
  }
}
// 静态属性
UserScore.$name = '/questionnaire/user/score'
export default UserScore
